#ifndef BADMINTON_H
#define BADMINTON_H

#include <QGraphicsPixmapItem>
#include <QObject>
#include <QTimer>

class Badminton : public QObject, public QGraphicsPixmapItem
{
    Q_OBJECT
public:
    Badminton(QPixmap pixmap, QGraphicsItem *parent = nullptr);
    void applyGravity();
    void hit(double forceX, double forceY);

private slots:
    void move();

private:
    double m_velocityX;//x轴方向速度
    double m_velocityY;//y轴方向速度
    QTimer *m_moveTimer;//实时更新图片位置
    const double GRAVITY = 0.1;
};

#endif // BADMINTON_H
